package com.ctsi.commons.util;


public class JavaSerializer implements Serializer {

	@Override
	public Object deserialize(byte[] data) {
		if(data==null || data.length==0)
			return null;
        return UtilObject.getObject(data);
	}

	@Override
	public byte[] serialize(Object obj) {
	   if(obj==null)
		   return new byte[0];
       return UtilObject.getBytes(obj);
	}

	@Override
	public Object deserialize(byte[] data, int offset, int length) {
		if(data==null || data.length==0 || length==0 )
			return null;
        return UtilObject.getObject(data,offset,length);
	}

}
